#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2021/7/29 18:45
# @Author  : Samge


class BaseMiddleware(object):

    # 是否使用代理
    is_use_proxy = True
    # 是否使用随机use-agent
    is_use_agent = True

    def __init__(self, crawler):
        self.is_use_proxy = crawler.settings.get('IS_USE_PROXY')
        self.is_use_agent = crawler.settings.get('IS_USE_AGENT')

    @classmethod
    def from_crawler(cls, crawler):
        return cls(
            crawler
        )
